package cn.school.thoughtworks.section1;

import java.util.ArrayList;
import java.util.List;

public class PracticeB {
    List<String> collectSameElements(List<String> collection1, List<List<String>> collection2) {
        //实现练习要求，并改写该行代码。
        List<String> result = new ArrayList<>();
        List<String> result1= collection2.get(0);
        for(int i=0;i<collection1.size();i++){
            for(int j=0;j<=result1.size()-1;j++){
                if(collection1.get(i).equals(result1.get(j))){
                    result.add(collection1.get(i));
                }
            }
        }
        return result;
    }
}
